//命名空间函数
function initNameSpace(router)
{	if(!router||router=='')
	{
		return;
	}
	var p=window,arrNS=router.split('.');
	for(var i=0,len=arrNS.length;i<len;i++)
	{
		if(!p[arrNS[i]])
		{
			p[arrNS[i]]={};
		}
		p=p[arrNS[i]];
	}
}

//申请如下空间名称
initNameSpace('juxiangyou.lib');//基本配置
initNameSpace('juxiangyou.core');//核心结构
initNameSpace('juxiangyou.component');//公共组件


/*
constant=document.createElement("script");
constant.setAttribute("type","text/javascript");
constant.setAttribute("src","/js/constant.js");
document.body.appendChild(constant);

var oHead = document.getElementsByTagName('HEAD').item(0);   
var oScript= document.createElement("script");   
oScript.type = "text/javascript";   
oScript.src="/js/constant.js";   
oHead.appendChild( oScript);   
*/



juxiangyou.lib.constant = {
   __SITE_URL: 'http://www.juxiangyou.com',
    __STATIC_URL: 'http://image.juxiangyou.com',
    __SITE_DOMAIN: 'juxiangyou.com',
	__SITE_DOMAIN2: 'www.juxiangyou.com',
    __PAGE_WIDTH: 950,
    __POLL_INTERVAL: 30000,
    __TUITA_INDEX_INTERVAL: 30000,
    __TUITA_APP_INTERVAL: 30000,
    __MSG_CHK_INTERVAL: 30000,
    __MSG_LETTER_INTERVAL: 5000
};


juxiangyou.core.func = {
	setTimeout:function(callback, timeout, param){ 　　
		//带参数的setTimeout
		var args = Array.prototype.slice.call(arguments, 2); 　　   
		var _cb = function() { 　　                   
			callback.apply(null, args); 　　             
		} 　　   
		setTimeout(_cb, timeout);
	},
	setPopupDivPos:function(layer, extW, extH){
		//reset：用于窗口resize等事件时的特殊处理标志
		var reset = reset || null;
		var layerH = layer.height();
		var windowH = $(window).height();
		var layerW = layer.width(); 
		var windowW = $(window).width();
		var l = layerW>=windowW ? $(document).scrollLeft(): $(document).scrollLeft() + (windowW - layerW - extW)/2 + "px";
		//如果层高度大于窗口高度，层上边缘与窗口顶部对齐显示，如果层高度小于等于窗口高度，则层在窗口中垂直居中显示
		var t = layerH>=windowH ? $(document).scrollTop(): (windowH - layerH - extH)/2 + "px";
		//t = '30%';
		
		layer.css({position:'fixed',top:t, left:l}).hide(); 
		//layer.css({}); 
		layer.fadeIn("nomal");
	},
	hidePopupDiv:function(layer){
		//手动关闭弹出DIV
		if(juxiangyou.component.popup._layer) $('#background-Layer').fadeOut("nomal",function(){$(this).remove()});
		layer.fadeOut("nomal",function(){$(this).remove()});
		if(juxiangyou.component.popup._href) window.location.href=juxiangyou.component.popup._href;
		if(juxiangyou.component.popup._reload) location.reload(true);
	},
	autoHidePopupDiv:function(layer,time){
		//自动关闭弹出DIV
		this.setTimeout(this.hidePopupDiv,time,layer);
	},
    getRequest:function(){
       var url = location.search; //获取url中"?"符后的字串
       var theRequest = new Object();
       if (url.indexOf("?") != -1) {
          var str = url.substr(1);
          strs = str.split("&");
          for(var i = 0; i < strs.length; i ++) {
             theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
          }
       }
       return theRequest;
    },
	d_checklogin:function(flag){
		$('.checkLogin').each(function (index, domEle) {
			if(flag)
			{
				if(this.href)
				{
					this.href='#';
				}
				$(domEle).unbind("click").removeAttr('onclick').click( function (event) 
				{
						event.preventDefault();					
						event.stopPropagation();
						juxiangyou.component.popup.login();
						return false;
				});
			}
		});
	},
	getScrollTop: function () {
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
    },
    getScrollLeft: function () {
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
    },
    getClientHeight: function () {
        return (document.compatMode == "CSS1Compat") ? document.documentElement.clientHeight : document.body.clientHeight;
    },
    getTotalWidth: function () {
        return (document.compatMode == "CSS1Compat") ? document.documentElement.clientWidth : document.body.clientWidth;
    },
    getScrollWidth: function () {
        return (document.compatMode == "CSS1Compat") ? document.documentElement.scrollWidth : document.body.scrollWidth;
    },
    getScrollHeight: function () {
        return (document.compatMode == "CSS1Compat") ? document.documentElement.scrollHeight : document.body.scrollHeight;
    },
    addFavorite: function(sURL,sTitle){
    	try
        {
            window.external.addFavorite(sURL, sTitle);
        }
        catch (e)
        {
            try
            {
                window.sidebar.addPanel(sTitle, sURL, "");
            }
            catch (e)
            {
                alert("加入收藏失败，请使用Ctrl+D进行添加");
            }
        }
    },
    setHome: function(obj,vrl){
    	try{
            obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
	    }
	    catch(e){
	            if(window.netscape) {
	                    try {
	                            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
	                    }
	                    catch (e) {
	                            alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
	                    }
	                    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
	                    prefs.setCharPref('browser.startup.homepage',vrl);
	             }
	    }
    },
	formatCurrency:function(num,c) {
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num)) num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10) cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
		if(c) return (((sign)?'':'-') + '$' + num + '.' + cents);
		else return (((sign)?'':'-') + num);
    }
};





juxiangyou.component.popup = {
	_id:null,
	_layer:true,
	_autoColse:false,
	_autoColseTime:2000,
	_reload:false,
	_href:null,
	waiting:function(){
		//等待框
		_html = [];
	},
	success:function(msg){
		//成功提示框
		var _html = [];
		this._id = 'jxy_pop_success';
		this._layer = true;
		this._autoColse = true;
		//_html[_html.length] = '<div class="html_clew_box_success" id="ui_messageBox">';
		//_html[_html.length] = '<div class="html_clew_box_close"><a href="javascript:void(0)" onclick="juxiangyou.core.func.hidePopupDiv($(\'#ui_messageBox\'));" title="关闭"></a></div>';
		//_html[_html.length] = '<div class="html_clew_box_con" id="ui_messageContent">'+msg+'</div></div>';
		
		_html[_html.length] = '<div class="dh_tips" id="'+this._id+'">';
		_html[_html.length] = '<div class="dh_tips_l"></div>';
		_html[_html.length] = '<div class="dh_tips_c"><span class="ok"></span>'+msg+'</div>';
		_html[_html.length] = '<div class="dh_tips_r"></div>';
		_html[_html.length] = '<div class="clear"></div></div>';
		
		this.box(_html,0,0);
	},
	error:function(msg){
		//错误提示框
		var _html = [];
		this._id = 'jxy_pop_info';
		this._layer = true;		
		this._autoColse = true;	
		//_html[_html.length] = '<div class="html_clew_box_error" id="ui_messageBox">';
		//_html[_html.length] = '<div class="html_clew_box_close"><a href="javascript:void(0)" onclick="juxiangyou.core.func.hidePopupDiv($(\'#ui_messageBox\'));" title="关闭"></a></div>';
		//_html[_html.length] = '<div class="html_clew_box_con" id="ui_messageContent">'+msg+'</div></div>';
		_html[_html.length] = '<div class="dh_tips" id="'+this._id+'">';
		_html[_html.length] = '<div class="dh_tips_l"></div>';
		_html[_html.length] = '<div class="dh_tips_c"><span class="wrong"></span><span class="re1">'+msg+'</span></div>';
		_html[_html.length] = '<div class="dh_tips_r"></div>';
		_html[_html.length] = '<div class="clear"></div></div>';
		
		this.box(_html,0,0);
	},
    loading:function(){
        //错误提示框
        var arr = [];
        this._id = 'jxy_pop_loading';
        this._layer = false;
        this._autoColse = false;
        
        arr.push('<div class="html_clew_box_loading" id="'+this._id+'">');
        arr.push('<div class="html_clew_box_con" id="ui_messageContent"><img src="'+juxiangyou.lib.constant.__SITE_URL+'/images/loading2.gif" /></div></div>');
        this.box(arr,60,0);
    },
	info:function(msg){
		//消息框，待设计
		var _html = [];
		this._id = 'jxy_pop_info';
		this._layer = true;
		this._autoColse = true;
		//_html[_html.length] = '<div class="html_clew_box_success" id="ui_messageBox">';
		//_html[_html.length] = '<div class="html_clew_box_close"><a href="javascript:void(0)" onclick="juxiangyou.core.func.hidePopupDiv($(\'#ui_messageBox\'));" title="关闭"></a></div>';
		//_html[_html.length] = '<div class="html_clew_box_con" id="ui_messageContent">'+msg+'</div></div>';
		
		_html[_html.length] = '<div class="dh_tips" id="'+this._id+'">';
		_html[_html.length] = '<div class="dh_tips_l"></div>';
		_html[_html.length] = '<div class="dh_tips_c"><span class="wrong"></span><span class="re1">'+msg+'</span></div>';
		_html[_html.length] = '<div class="dh_tips_r"></div>';
		_html[_html.length] = '<div class="clear"></div></div>';
		
		this.box(_html,0,0);
	},
	prompt:function(msg,w){
		//提示框
		var _html = [];
		this._id = 'jxy_pop_prompt';
		this._layer = true;
		this._autoColse = true;
		
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>提示：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		_html[_html.length] = '<p><strong>'+msg+'</strong></p>';
		//_html[_html.length] = '<p class="btn"><a href="#" class="public_w_btn_y">确认</a>&nbsp;&nbsp;&nbsp;<a href="#" class="public_w_btn_n">关闭</a></p>';
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	prompts:function(msg,w){
		//提示框
		var _html = [];
		this._id = 'jxy_pop_prompt';
		this._layer = true;
		this._autoColse = true;
		
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>提示：</strong></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		_html[_html.length] = '<p><strong>'+msg+'</strong></p>';
		//_html[_html.length] = '<p class="btn"><a href="#" class="public_w_btn_y">确认</a>&nbsp;&nbsp;&nbsp;<a href="#" class="public_w_btn_n">关闭</a></p>';
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	popSys:function(msg,w){
		//提示框
		var _html = [];
		this._id = 'jxy_pop_sysmsg';
		this._layer = true;
		this._autoColse = false;
		
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>提示：</strong><a href="javascript:void(0);" onclick="closePopCash()" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		_html[_html.length] = '<p><strong>'+msg+'</strong></p>';
		_html[_html.length] = '<p class="btn"><a href="javascript:void(0);" onclick="closePopCash()" class="public_w_btn_y">确认</a></p>';
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	popSys1:function(title,str,w){
		//提示框，内容自定义，无确认按钮 无取消按钮
		var _html = [];
		this._id = 'jxy_pop_popSys1';
		this._layer = true;
		this._autoColse = false;
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>'+title+'</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		_html[_html.length] = str;
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	popSys2: function(e, t) {
		//提示框，内容自定义，有确认按钮 无取消按钮
        var n = [];
        this._id = "jxy_pop_sysmsg", this._layer = !0, this._autoColse = !1, n[n.length] = '<div class="public_w" id="' + this._id + '" style="width:' + t + 'px; z-index:9999;">', 
        n[n.length] = '<div class="public_w_in" style="width:' + t + 'px;">', n[n.length] = '<div class="public_w_t"><strong>提示：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#' + this._id + '\'));" title="关闭"></a></div>', 
        n[n.length] = '<div class="publick_w_c">', n[n.length] = "<p style='text-indent: 2em;text-align:left;'><strong>" + e + "</strong></p>", 
        n[n.length] = '<p class="btn"><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#' + this._id + '\'));" class="public_w_btn_y">确认</a></p>', 
        n[n.length] = "</div></div></div>", this.box(n, 0, 0);
    },
	popDeleteSure:function(adID,w){
		//提示框
		var _html = [];
		this._id = 'jxy_pop_deletesure';
		this._layer = true;
		this._autoColse = false;
		w = 300;
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>提示：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		_html[_html.length] = '<p><strong>确认删除操作？</strong></p>';
		_html[_html.length] = '<p class="btn"><a href="javascript:void(0);" onclick="detRecord('+adID+')" class="public_w_btn_y">确认</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" class="public_w_btn_y">取消</a></p>';
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	popWealthSure:function(gold,str){
		//提示框
		var _html = [];
		this._id = 'jxy_pop_wealthsure';
		this._layer = true;
		this._autoColse = false;
		w = 400;
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>提示：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		_html[_html.length] = '<p>是否转入聚财宝<strong class="ofe">'+gold+'</strong>U币？</p>';
		_html[_html.length] = '<p><i class="re1">'+str+'</i></p>';
		_html[_html.length] = '<p class="btn"><a href="javascript:void(0);" onclick="wealthUGold()" class="public_w_btn_y">确认</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" class="public_w_btn_y">取消</a></p>';
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	popDoSure:function(title,str,w){
		//提示框，内容自定义，有确认按钮 有取消按钮
		var _html = [];
		this._id = 'jxy_pop_dosure';
		this._layer = true;
		this._autoColse = false;
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>'+title+'</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		_html[_html.length] = str;
		_html[_html.length] = '<p class="btn"><a href="javascript:void(0);" onclick="doSure()" class="public_w_btn_y">确认</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" class="public_w_btn_y">取消</a></p>';
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	popGameTip:function(title,e,t){
		//确认 是或否
		var n = [];
		//this._autoColse = true;
		this._autoColseTime = 5000;
        this._id = "jxy_pop_gametip", this._layer = !0, this._autoColse = 1, n[n.length] = '<div class="public_w" id="' + this._id + '" style="width:' + t + 'px; z-index:9999;">', 
        n[n.length] = '<div class="public_w_in" style="width:' + t + 'px;">', n[n.length] = '<div class="public_w_t"><strong>'+title+'</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#' + this._id + '\'));" title="关闭"></a></div>', 
        n[n.length] = '<div class="publick_w_c">', n[n.length] = "<p style='text-indent: 2em;'><strong>" + e + "</strong></p>", 
        //n[n.length] = '<p class="btn"><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#' + this._id + '\'));" class="public_w_btn_y">确认</a></p>', 
        n[n.length] = "</div></div></div>", this.box(n, 0, 0);
	},
	/*
	陈胜强 
	修改“立即兑换”弹窗
	添加手机选项
	start
	*/
	cardExcharge:function(str,type){
		var _html = [];
		this._id = 'jxy_pop_sure';
		this._layer = true;
		this._autoColse = false;
		w = 400;
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>提示：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		_html[_html.length] = '<p>是否兑换<strong class="ofe">'+str+'</strong></p>';
		if(type == "phone"){
			_html[_html.length] = '<p><i class="re1">请输入手机号：<input type="text" value="" id="cardPhone" name="cardPhone"></i></p>';
		}
		_html[_html.length] = '<p class="btn"><a href="javascript:void(0);" onclick="toPrize()" class="public_w_btn_y">确认</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" class="public_w_btn_y">取消</a></p>';
		_html[_html.length] = '</div></div></div>';
		this.box(_html,0,0);
	},
	/*end*/
	surePirze:function(){
		var _html = [];
		this._id = 'jxy_pop_sure';
		this._layer = true;
		this._autoColse = false;
		
		_html[_html.length] = '<div class="dh_tips" id="'+this._id+'">';
		_html[_html.length] = '<div class="dh_tips_l"></div>';
		_html[_html.length] = '<div class="dh_tips_c"><span class="ok"></span>确认兑换该奖品？&nbsp;&nbsp;<a href="javascript:void(0);" onclick="toPrize()" onmouseover="$(this).attr(\'class\',\'qrdh\');" onmouseout="$(this).attr(\'class\',\'\');">是</a>&nbsp;<span class="da3">/</span>&nbsp;<a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#jxy_pop_sure\'));" onmouseover="$(this).attr(\'class\',\'qrdh\');" onmouseout="$(this).attr(\'class\',\'\');">否</a></div>';
		_html[_html.length] = '<div class="dh_tips_r"></div>';
		_html[_html.length] = '<div class="clear"></div>';
		_html[_html.length] = '</div>';
		this.box(_html,0,0);
	},
	login: function () {
        var loginContainerId = "Login_out",
			content = "";
        if ($("#"+loginContainerId).length == 0) {
            var arr = [];
            arr.push('<div id="Login_out" class="Login_obox IE6png" >');
			arr.push('<div class="Login_oboxi">');
            arr.push('<p class="title">会员登录<span class="cloesd"><a href="javascript:void(0)" onclick="juxiangyou.core.func.hidePopupDiv($(\'#Login_out\'));"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/login/cloes.gif" /></a></span></p>');
			arr.push('<form   action="/login.php?act=poplogin" method="post" name="login" target="loginiframe" id="loginformbox">');
            arr.push('<ul>');
            arr.push('<li class="a1">邮箱：</li>');
            arr.push('<li class="a2"><input class="Lobox_In" id="tbUserAccount" name="tbUserAccount" tabindex="1" value="" /></li><li class="a3"><a href="'+juxiangyou.lib.constant.__SITE_URL+'/reg.php" >注册</a></li>');
            arr.push('<li class="a1">密码：</li>'); 
            arr.push('<li class="a2"><input class="Lobox_In" id="tbUserPwd" name="tbUserPwd" type="password" value="" tabindex="2"/></li><li class="a3"><a href="'+juxiangyou.lib.constant.__SITE_URL+'/forgetPwd.php" >忘记密码？</a></li>');
			arr.push('<li class="a1">验证码：</li>'); 
            arr.push('<li class="a2"><input class="Lobox_In2" id="tbUserCode" name="tbUserCode" type="text" value="" tabindex="2"/><img src="'+juxiangyou.lib.constant.__SITE_URL+'/authCode.php?s=poplogin" id="qCode_pic" onclick="$(this).attr(\'src\',\'/authCode.php?s=poplogin&\'+Math.random()*1000);" style="cursor:pointer;margin-left:3px;vertical-align: -8px;" title="点击刷新"></li><li class="a3"><a href="'+juxiangyou.lib.constant.__SITE_URL+'/forgetPwd.php" >&nbsp;</a></li>');
			arr.push('<li class="a1 last"></li>');
			arr.push('<li class="a2 last"><a href="javascript:void(0)" onclick="$(\'#loginformbox\').submit()"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/login/login_btn.gif" /></a></li>'); 
            arr.push('<li class="a3 last"><!--<input type="checkbox" value="1" id="rememberme" name="rememberme" class="Ljz">自动登录--></li>');            arr.push('<li class="a1" ></li>');
			arr.push('<li class="a2">其他账号登录:<a href="'+juxiangyou.lib.constant.__SITE_URL+'/wlogin.php?t=sina"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/login/sina.gif" alt="新浪微博" class="Loicon" /></a><a href="javascript:void(0);" onclick="toQzoneLogin()"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/login/qq.gif" alt="QQ" class="Loicon" /></a>');
			arr.push('<li class="a3"></li>');
			arr.push('</ul><input type="hidden" name="top_k" value="1"/></form>'); 
			arr.push('</div><iframe id="loginiframe" name="loginiframe" style="display:none"></iframe></div>');	 
			
            //$(arr.join('')).appendTo($('body', $(document)));
			this._layer = true;
			this._autoColse = false;
			this.box(arr,0,0);           
            //arr = null;
        }else
		{
			$("#"+loginContainerId).show();
		}
		var scrollTop = juxiangyou.core.func.getScrollTop(),
			top = scrollTop + 200;
		$("#"+loginContainerId).css("top",top);
		$("#"+loginContainerId).css("z-index",100);
		window.setTimeout(function () {
			$("#tbUserPwd").keypress(function (e) {
                var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
                if (keyCode == 13) {
					$('#loginformbox').submit();
                } else
                return true;
            });
		},500);

	},
	checkAnswer:function(question){
		//验证问题
		var arr = [];
		arr.push('<div class="user_tc_box clearfix">');
		arr.push('<ul><li class="l1">您的密码保护问题：</li>');
		arr.push('<li class="l2"><font class="red">'+question+'</font></li>');
		arr.push('<li class="l1">输入保护问题答案：</li>');
		arr.push('<li class="l2"><input name="tbUserSecAns" id="tbUserSecAns" class="tc_input" type="text" style="width:200px;"></li>');
		arr.push('<li class="l3"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/user/btn_tctj.gif" style="cursor:pointer;" border="0" onclick="return checkProtectValue();" align="absmiddle">&nbsp;&nbsp;<a href="userRetrieve.php" class="font_wj">忘记密保？</a></li>');
		arr.push('<div class="close"><a href="javascript:;" onclick="closeBanner();"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/user/web_close.png" border="0"></a></div></div>');
		
		this._layer = true;
		this._autoColse = false;
		this.box(arr,100,0);
	},
    prizeConfirm:function(pid){
        //奖品确认框
        var arr = [];
        arr.push('<div class="Pop_bgr" id="prizeConfirm_div">');
        arr.push('<div class="Pop_bk">');
        arr.push('<ul><li class="l1">输入份数：</li><li class="l2"><input type="text" name="txtNum" id="txtNum" value="1"/></li><li class="l1">密保问题：</li><li class="l2">');
        arr.push('<select name="tbUserSecQues" id="tbUserSecQues" class="st_select">');
        arr.push('<option selected="selected" value="-">请选择密保问题</option>');
        arr.push('<option value="0">你父亲的姓名是什么?</option>');
        arr.push('<option value="1">你母亲的姓名是什么?</option>');
        arr.push('<option value="2">你的出生地?</option>');
        arr.push('<option value="3">你的宠物的名字?</option>');
        arr.push('<option value="4">你的职业是什么?</option>');
        arr.push('<option value="5">你配偶的职业是什么?</option>');
        arr.push('</select> </li><li class="l1">密保答案：</li><li class="l2"><input type="text" name="tbUserSecAns" id="tbUserSecAns"></li></ul>');
        arr.push('<ul><li class="l3"><span class="fontRed" id="errorMsg">提示：请输入正确的密保信息。</span></li><li class="l3"><input name="giftCrim" type="image" src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/gift/duih.gif" id="giftCrim"/>&nbsp;&nbsp;<input name="Input" type="image" src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/gift/button_09.gif" onclick="juxiangyou.core.func.hidePopupDiv($(\'#prizeConfirm_div\'));"/></li></ul>');
        arr.push('</div></div>');
        
        this._layer = true;
        this._autoColse = false;
        this.box(arr,0,0);


		$('#giftCrim').live('click',function(){
			var _txtNum = $('#txtNum').val();
			var _tbUserSecQues = $('#tbUserSecQues').val();
			var _tbUserSecAns = $.trim($('#tbUserSecAns').val());
			var errorMsg = $('#errorMsg');

			if(!/^[1-9]+[0-9]*$/.exec(_txtNum)){
				errorMsg.html("请填写正确的奖品分数！");
				$('#txtNum').focus();return;
			}
			if(_tbUserSecQues == "-"){
				errorMsg.html("请选择密保问题！");
				$('#tbUserSecQues').focus();return;
			}
			if(_tbUserSecAns == ""){
				errorMsg.html("请填写密保答案！");
				$('#tbUserSecAns').focus();return;
			}

			$.ajax({
				type:'POST',
				url:'/ajax.php',
				data:{"act":'exchangeGift',"pid":pid,"num":_txtNum,"tbUserSecQues":_tbUserSecQues,"tbUserSecAns":_tbUserSecAns},
				dataType:'json',
				error:function(){
					alert('请求已经提交，请稍等~');
				},
				success:function(rst){
					
					if(rst.result==200){
						juxiangyou.core.func.hidePopupDiv($('#prizeConfirm_div'));
						juxiangyou.component.popup.success(rst.msg);
					}else if(rst.result==404){
						errorMsg.html(rst.msg);
					}else{
						juxiangyou.core.func.hidePopupDiv($('#prizeConfirm_div'));
						juxiangyou.component.popup.error(rst.msg);
					}
				}
			});
		});
    },
    askAdverts:function(aid,obj,w){
		var arr = [];
		this._id = 'jxy_pop_ask';
		this._layer = true;
		this._autoColse = false;
		var data = obj.data;

		arr.push('<div id="'+this._id+'" class="public_w" style="width:450px;z-index:9999;">');
		arr.push('<div class="public_w_in" style="width:450px;">');
		arr.push('<div class="public_w_t"><strong>及时赚商家问答</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>');
		arr.push('<div class="publick_w_c">');
		arr.push('<p class="askt"><strong class="g2f">问题：'+obj.title+'</strong></p>');
		
		$.each(data, function(i, n) {
			if(obj.type == 'checkbox') {
				arr.push('<p class="ask"><label><input name="answer[]" type="checkbox" value="'+i+'">&nbsp;<span >'+n+'</span></label></p>');
			} else {
				arr.push('<p class="ask"><label><input name="answer" type="radio" value="'+i+'">&nbsp;<span >'+n+'</span></label></p>');
			}	
		});
		arr.push('<p style="display: none;height:28px; font-size:12px;" id="errorMsg"><span class="re1">回答错误，请重新选择答案</span></p>');
		arr.push('<p class="btn"><a href="javascript:void(0);" class="public_w_btn_y" onclick="submitAsk('+aid+')">提交</a></p>');
		arr.push('</div></div></div>');
		this.box(arr,0,0);
    },
	choosePayType:function(methodList,s,w){
		var arr = [];
		this._id = 'jxy_pop_pay';
		this._layer = true;
		this._autoColse = false;
		if(s==1){
			var name = '支付宝';var sign = 'alipay';
		}else if(s==2){
			var name = '财付通';var sign = 'tenpay';
		}else{
			var name = '银行卡';var sign = 'bink_bank';
		}
		arr.push('<div class="public_w" id="'+this._id+'" style="width:'+w+'px;z-index:999;">');
		arr.push('<div class="public_w_in" style="width:'+w+'px;">');
		arr.push('<div class="public_w_t"><strong>选择其他'+name+'</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>');
		arr.push('<div class="publick_w_c"><p class="a1">');
		if(methodList.length>0){
			for(var i=0;i<methodList.length;i++){
				arr.push('<input name="tblPayMethod" type="radio" value="'+methodList[i][0]+'" style="vertical-align:-1px; margin-right:2px;" onclick="chooseDone('+i+')">'+methodList[i][1]+'&nbsp;&nbsp;&nbsp;'+methodList[i][2]+'<br>');
			}
		}
		arr.push('<a href="index.php?m=Member&c=Account&a='+sign+'" class="b40link">+绑定新'+name+'</a></p>');
		arr.push('</div></div></div>');
		
		this.box(arr,0,0);
    },
	treasureNoCounts:function(){
		var arr = [];
		this._id = 'jxy_pop_notEnough';
		this._layer = true;
		this._autoColse = false;

		arr.push('<div id="'+this._id+'" class="public_w" style="width:400px; z-index:9999;">');
		arr.push('<div class="public_w_in" style="width:400px;">');
		arr.push('<div class="public_w_t"><strong>提示：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>');
		arr.push('<div class="publick_w_c">');
		arr.push('<p ><strong>您的挖宝次数不足！</strong></p>');
		arr.push('<p style="font-size:12px;">您可以通过以下方式增加挖宝次数：</p>');
		arr.push('<p><b><a href="'+juxiangyou.lib.constant.__SITE_URL+'/" class="ofe">每日签到</a></b>&nbsp;&nbsp;<b><a href="'+juxiangyou.lib.constant.__SITE_URL+'/games/" class="ofe">试玩平台</a></b>&nbsp;&nbsp;<b><a href="'+juxiangyou.lib.constant.__SITE_URL+'/recommend/Detail/" class="ofe">邀请好友</a></b>&nbsp;&nbsp;<b><a href="'+juxiangyou.lib.constant.__SITE_URL+'/captcha/" class="ofe">打码</a></b></p>');
		arr.push('</div></div></div>');

		this.box(arr,0,0);
	},
	treasureDone:function(msg){
		var arr = [];
		this._id = 'jxy_pop_done';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div id="'+this._id+'" class="wbok" style="z-index:9999;">');
		arr.push('<label><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/cloesd.png"></a></label>');
		arr.push('<p class="a1">恭喜您获得</p>');
		arr.push('<p class="a2">'+msg+'</p>');
		arr.push('</div>');

		this.box(arr,0,0);
	},
	treasureMy:function(obj,total){
		var arr = [];
		this._id = 'jxy_pop_my';
		this._layer = true;
		this._autoColse = false;
		
		arr.push('<div id="'+this._id+'" class="public_w" style="width:300px;z-index:9999;">');
		arr.push('<div class="public_w_in" style="width:300px;">');
		arr.push('<div class="public_w_t"><strong>已挖到的宝藏：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>');
		arr.push('<div class="publick_w_c"><ul class="bzlist">');
		for(var i=0;i<total;i++){
			if(i>=max) break;
			var d = eval('obj.'+'data'+i);
			arr.push('<li>'+d[0]+'<span class="da3">'+d[1]+'</span></li>');
		}
		
		arr.push('<li class="pageup"><a href="javascript:void(0);" class="b40link" onclick="prev()">上一页</a>&nbsp;&nbsp;<a href="javascript:void(0);" class="b40link" onclick="next()">下一页</a><br /><i class="da3">（共'+total+'条信息）</i></li>');
		arr.push('</ul></div></div></div>');

		this.box(arr,0,0);
	},
	awardGames:function(gold,score){
		//试玩奖励领取成功
		var arr = [];
		this._id = 'jxy_pop_award';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div id="'+this._id+'" class="public_w" style="width:300px;z-index:9999;">');
		arr.push('<div class="public_w_in" style="width:300px;">');
		arr.push('<div class="public_w_t"><strong>提示：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>');
		arr.push('<div class="publick_w_c"');
		// arr.push('<p><strong>领取成功！</strong></p>');
		if(gold>0) arr.push('<p>共奖励U币：<strong class="ofe">+'+gold+'</strong><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/ub.gif" style="margin-left:2px;"/></p>');
		if(score>0) arr.push('<p>共奖励U豆：<strong class="ofe">+'+score+'</strong></p>');
		// arr.push('<p>您可以在<a href="'+juxiangyou.lib.constant.__SITE_URL+'/personal/Account/" class="b40link" style="text-decoration:underline;">会员中心</a>查看您的试玩记录。</p>');
		arr.push('<p><strong>领取成功！</strong></p>');
		arr.push('<p class="btn"><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" class="public_w_btn_y">确认</a></p>');
		arr.push('</div></div></div>');

		this.box(arr,0,0);
	},
	gamesPop:function(adID){
		var arr = [];
		this._id = 'jxy_pop_games';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div id="'+this._id+'" class="game_wds" style="z-index:9999;width"><a href="'+juxiangyou.lib.constant.__SITE_URL+'/hitsJump.php?adID='+adID+'"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/advert/C'+adID+'.jpg"  width="600" height="280"/></a><label><a href="javascript:void(0);" onclick="closePopGame('+adID+')"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/gamety/cls.png" /></a></label></div>');
		this.box(arr,0,0);
	},
	captchaPop:function(title,link,src){
		//打码页弹出推荐图片
		var arr = [];
		this._id = 'jxy_pop_captcha';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div id="'+this._id+'" class="game_wds" style="z-index:9999;width" title="'+title+'"><a href="'+link+'"><img src="'+src+'" width="600" height="280"/></a><label><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/gamety/cls.png" /></a></label></div>');
		this.box(arr,0,0);
	},
	advertPop:function(adID,title,link,src){
		//页面广告位置弹框，600x280
		var arr = [];
		this._id = 'jxy_pop_advert';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div id="'+this._id+'" class="game_wds" style="z-index:9999;width" title="'+title+'"><a  href="javascript:void(0);" onclick="closePopAdvert('+adID+',1)"><img src="'+src+'" width="600" height="280"/></a><label><a href="javascript:void(0);" onclick="closePopAdvert('+adID+',0)" title="关闭"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/gamety/cls.png" /></a></label></div><script type="text/javascript">function closePopAdvert(adID,sign){;$.ajax({type: "POST",url: "/ajax/",dataType: "json",data : "act=closePopAdvert&adID="+adID,success: function(strJson){juxiangyou.core.func.hidePopupDiv($(\'#jxy_pop_advert\'));if(sign) document.location.href = "'+link+'";}});}</script>');
		this.box(arr,0,0);
	},
	newTaskPop:function(){
		var arr = [];
		this._id = 'jxy_pop_new';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div id="'+this._id+'" class="newTask_wds" style="z-index:9999;"><a href="'+juxiangyou.lib.constant.__SITE_URL+'/newTask/#award"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/new_560x280.gif"  width="560" height="280"/></a><label><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/gamety/cls.png" /></a></label></div>');
		this.box(arr,0,0);
	},
	redPacketPop:function(){
		var arr = [];
		this._id = 'jxy_pop_redPacket';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div id="'+this._id+'" class="newTask_wds" style="z-index:9999;width:500px;height:300px;"><a href="'+juxiangyou.lib.constant.__SITE_URL+'/personal/Packet/"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/alert/redPacket.jpg"  width="500" height="300"/></a><label><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/gamety/cls.png" /></a></label></div>');
		this.box(arr,0,0);
	},
	jucaibaoPop:function(){
		var arr = [];
		this._id = 'jxy_pop_jucaibao';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div id="'+this._id+'" class="newTask_wds" style="z-index:9999;width:680px;height:220px;"><a href="'+juxiangyou.lib.constant.__SITE_URL+'/personal/Wealth/"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/alert/jucaibao.jpg"  width="680" height="220"/></a><label><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/gamety/cls.png" /></a></label></div>');
		this.box(arr,0,0);
	},
	submitAdCode:function(w){
		//提示框
		var _html = [];
		this._id = 'jxy_pop_adCode';
		this._layer = true;
		this._autoColse = false;
		
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>广告体验-提交绑定信息：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		//_html[_html.length] = '<p><strong>提交绑定信息：</strong></p>';
		_html[_html.length] = '<input id="jxy_input_code" type="text" style="border:1px solid #dedede; height:26px; line-height:26px; padding:0 5px; font-size:14px; width:200px;" />';
		_html[_html.length] = '<p class="btn"><a href="javascript:void(0);" onclick="alertCode()" class="public_w_btn_y">确认</a>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" class="public_w_btn_n">关闭</a></p>';
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	submitGameCode:function(title,w){
		//提示框
		var _html = [];
		this._id = 'jxy_pop_adCode';
		this._layer = true;
		this._autoColse = false;
		
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:'+w+'px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:'+w+'px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>'+title+'-提交绑定信息：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		//_html[_html.length] = '<p><strong>提交绑定信息：</strong></p>';
		_html[_html.length] = '<input id="jxy_input_code" type="text" style="border:1px solid #dedede; height:26px; line-height:26px; padding:0 5px; font-size:14px; width:200px;" />';
		_html[_html.length] = '<p class="btn"><a href="javascript:void(0);" onclick="alertCode()" class="public_w_btn_y">确认</a>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" class="public_w_btn_n">关闭</a></p>';
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	moonCake:function(img,cake){
		var arr = [];
		this._id = 'jxy_pop_moon';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" class="Moon_wds" id="'+this._id+'" style="z-index:999;background:url('+juxiangyou.lib.constant.__STATIC_URL+'/images/alert/mooncake/mooncake'+img+'.jpg)"><!--序号1-9--><label><a href="javascript:void(0);"  title="关闭"><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/gamety/cls.png" /></a></label><div class="Moon_txt">恭喜你获得<br />及时赚送出的月饼<br /><span>+'+cake+'币</span></div>');
		this.box(arr,0,0);
	},
	awardVipCard:function(html,url){
		var arr = [];
		this._id = 'jxy_pop_awardVipCard';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div class="black-tan" id="'+this._id+'"><a class="close-btn" href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));"></a>'+html+'<a class="btn-lingqu" href="'+url+'">立即领取</a></div>');
		this.box(arr,0,0);
	},
	anniversaryLoginAward:function(awardG,awardF){
		var arr = [];
		this._id = 'jxy_pop_anniversaryLoginAward';
		this._layer = true;
		this._autoColse = false;
		arr.push('<div class="tan-box" id="'+this._id+'"><p class="style1">获得:<strong>'+awardG+'</strong>U币</p><p class="style2"><strong>'+awardF+'</strong>U豆</p><a class="style3" href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));">确定</a></div>');
		this.box(arr,0,0);
	},
	wealthPop:function(msg){
		//提示框
		var _html = [];
		this._id = 'jxy_pop_sysmsg';
		this._layer = true;
		
		_html[_html.length] = '<div class="public_w" id="'+this._id+'" style="width:300px; z-index:9999;">';
		_html[_html.length] = '<div class="public_w_in" style="width:300px;">';
		_html[_html.length] = '<div class="public_w_t"><strong>提示：</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>';
		_html[_html.length] = '<div class="publick_w_c">';
		_html[_html.length] = '<p><strong>转入成功!</strong></p>';
		_html[_html.length] = '<p><i>'+msg+'</i></p>';
		_html[_html.length] = '<p class="btn"><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" class="public_w_btn_y">确认</a></p>';
		_html[_html.length] = '</div></div></div>';
		
		this.box(_html,0,0);
	},
	exchangeUdou:function(userG,userF){
		//兑换U豆框
		var typeArr = ['1','5','10','50','100'];
		var typeNameArr = ['1万U币','5万U币','10万U币','50万U币','100万U币'];
		var arr = [];
		this._id = 'jxy_pop_exchange';
		this._layer = true;
		this._autoColse = false;
		var gold = $('#userG').html();
		var dou = $('#userF').html();
		arr.push('<div id="'+this._id+'" class="public_w" style="width:420px;z-index:9999;">');
		arr.push('<div class="public_w_in" style="width:420px;">');
		arr.push('<div class="public_w_t"><strong>兑换U币</strong><a href="javascript:void(0);" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" title="关闭"></a></div>');
		arr.push('<div class="publick_w_c" style="padding-left:10px; padding-right:10px;">');
		arr.push('<div class="dhud_sj"><strong>当前U币：<span class="ofe" id="jyx_span_gold">'+gold+'</span></strong><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/common/ub.gif" /><i>|</i>当前U豆：<span class="udcl" id="jyx_span_dou">'+dou+'</span></strong><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/xzgame/ud.gif" / style="vertical-align:2px;"></div>');
		arr.push('<div class="dhud_dh">兑换数量：<select id="exchangeType"><option value="0">---请选择兑换数量---</option>');
		for(var i=0;i<typeArr.length;i++){
			arr.push('<option value="'+typeArr[i]+'">'+typeNameArr[i]+'</option>');
		}
		arr.push('</select>&nbsp;<span>您将获得:<label class="udcl"><span id="jyx_span_getdou">0</span><img src="'+juxiangyou.lib.constant.__STATIC_URL+'/images/xzgame/ud.gif" /></label></span><br><span class="re1" id="jxy_error" style="margin-left:100px;"></span></div>');
		arr.push('<p class="btn" style="margin-top:30px; margin-bottom:10px;"><a class="public_w_btn_y" id="exchange_sure" href="javascript:void(0);">确认</a>&nbsp;&nbsp;&nbsp;<a class="public_w_btn_n" onclick="juxiangyou.core.func.hidePopupDiv($(\'#'+this._id+'\'));" href="javascript:void(0);">取消</a></p>');
		arr.push('</div></div></div>');
		this.box(arr,0,0);

		
		$('#exchangeType').change(function(){
			var v = $(this).val();
			var d = juxiangyou.core.func.formatCurrency(v*10000*10);
			$('#jyx_span_getdou').html(d);

			var g = userG*1-v*10000;
			var gd = juxiangyou.core.func.formatCurrency(g);
			$('#jyx_span_gold').html(gd);

			var f = userF*1+v*10000*10;
			var fd = juxiangyou.core.func.formatCurrency(f);
			$('#jyx_span_dou').html(fd);
		});
		
		$('#exchange_sure').click(function(){
			var v = $('#exchangeType').val();
			$('#exchange_sure').html("提交中...");
			$.ajax({
				type:'POST',
				url:'/ajaxDo.php',
				data:{"act":'exchangeDou',"v":v},
				dataType:'json',
				error:function(){
					juxiangyou.component.popup.prompt("请求已经提交，请稍等片刻~");
				},
				success:function(rst){
					if(rst.result==10000){
						juxiangyou.core.func.hidePopupDiv($('#jxy_pop_exchange'));
						juxiangyou.component.popup.prompt("成功兑换U豆"+rst.getDou+"，快来和柚子们玩试玩吧~");
						$('.userG').html(rst.gold);$('.userF').html(rst.dou);
					}else{
						$('#jxy_error').html(rst.msg);
						$('#jxy_error').slideDown(500);
						setTimeout("$('#jxy_error').slideUp(500);",1500);
					}
					$('#exchange_sure').html("确认");
				}
			});
		});
	},
	backgroundLayer:function(){
		//这是背景层
		var h = $("html").height();
		var _html = '<div class="boxy-modal-blackout" id="background-Layer" style="position:absolute;background-color: rgb(0, 0, 0); filter:alpha(opacity=50);opacity: 0.5;width: 100%; height: '+h+'px; top:0;z-index: 99;"></div>';
		$(_html).appendTo($('body', $(document)));
	},
	box:function(html,extW,extH){
		var objBox = $(html.join(''));
		objBox.prependTo($('body', $(document)));
        juxiangyou.core.func.setPopupDivPos(objBox,extW,extH);
		if(this._layer) this.backgroundLayer();
		if(this._autoColse) juxiangyou.core.func.autoHidePopupDiv(objBox,this._autoColseTime);
	}
	
};


juxiangyou.component.scroll = {
		_autoScroll:false,
		_delay:1000,
		_timeNode:false,
		_page:0,
		_width:0,
		_height:0,
		indexPPTScroll:function(){
			this._autoScroll = true;this._delay = 3000;this._width = 980;
			var divObj = $("div#jxy_div_indexPPT");
			var ulObj = $("ul.jxy_cls_indexPPT");
			var sWidth = $("ul.jxy_cls_indexPPT li").width();
			var len = ulObj.children('li').length;
			ulObj.css("width",sWidth * (len));
			
			this._timeNode = setInterval(function(){juxiangyou.component.scroll.autoMovePPT();},this._delay);
			
			divObj.hover(function(){clearInterval(juxiangyou.component.scroll._timeNode);}).mouseleave(function(){juxiangyou.component.scroll._timeNode = setInterval(function(){juxiangyou.component.scroll.autoMovePPT();},juxiangyou.component.scroll._delay);});
			
			$('.PPT_opt li').mouseenter(function(){clearInterval(juxiangyou.component.scroll._timeNode);var index = $('.PPT_opt li').index(this);juxiangyou.component.scroll.autoMovePPT(index);}).mouseleave(function(){juxiangyou.component.scroll._timeNode = setInterval(function(){juxiangyou.component.scroll.autoMovePPT();},juxiangyou.component.scroll._delay);});
		},
		autoMovePPT:function(p){
			var ulObj = $("ul.jxy_cls_indexPPT");
			var total = ulObj.children('li').length;
			this._page=this._page + 1;
			if(this._page == total) this._page = 0;
			if(p!=undefined) this._page = p;
			var move = -980*this._page;
			$('.PPT_opt li').removeClass('on').addClass('un');
			$('.PPT_opt li').eq(this._page).removeClass('un').addClass('on');
			var ulObj = $("ul.jxy_cls_indexPPT");
			ulObj.stop(true,false).animate({'left':move+'px'},300);
		},
		phonePPTScroll:function(){
			this._autoScroll = true;this._delay = 3000;this._width = 980;
			var divObj = $("div.sjsw_hd_img");
			var ulObj = $("ul.sjsw_hd_img_ul");
			var sHeight = $("ul.sjsw_hd_img_ul li").height();
			var len = ulObj.children('li').length;
			ulObj.css("height",sHeight * (len));
			
			this._timeNode = setInterval(function(){juxiangyou.component.scroll.autoPhonePPT();},this._delay);
			
			divObj.hover(function(){clearInterval(juxiangyou.component.scroll._timeNode);}).mouseleave(function(){juxiangyou.component.scroll._timeNode = setInterval(function(){juxiangyou.component.scroll.autoPhonePPT();},juxiangyou.component.scroll._delay);});
			
			$('.swsw_hd_opt li').mouseenter(function(){clearInterval(juxiangyou.component.scroll._timeNode);var index = $('.swsw_hd_opt li').index(this);juxiangyou.component.scroll.autoPhonePPT(index);}).mouseleave(function(){juxiangyou.component.scroll._timeNode = setInterval(function(){juxiangyou.component.scroll.autoPhonePPT();},juxiangyou.component.scroll._delay);});
		},
		autoPhonePPT:function(p){
			var ulObj = $("ul.sjsw_hd_img_ul");
			var total = ulObj.children('li').length;
			this._page=this._page + 1;
			if(this._page == total) this._page = 0;
			if(p!=undefined) this._page = p;
			var move = -248*this._page;
			$('.swsw_hd_opt li.on').find('i').remove();
			$('.swsw_hd_opt li').removeClass('on').addClass('un');
			$('.swsw_hd_opt li').eq(this._page).removeClass('un').addClass('on');
			$('.swsw_hd_opt li.on').prepend('<i></i>');
			var ulObj = $("ul.sjsw_hd_img_ul");
			ulObj.stop(true,false).animate({'top':move+'px'},300);
		}
};

juxiangyou.component.verification = {
		_reg:null,
		_necessarily:true,
		chkStrLen:function(str,minLength,maxLength){
			if(str.length < minLength) {
				return false;
			}
			if(maxLength != null && str.length > maxLength) {
				return false;
			}
			return true;
		},
		chkInt:function(int,minLength,maxLength,pattern){
			pattern = typeof(pattern) == 'undefined' ? '^-?[1-9]+[0-9]*$' : pattern;
			pattern = new RegExp(pattern);
			if(pattern.test(int)==false){
				return false;
			}
			return this.chkStrLen(int,minLength,maxLength);
		},
		chkPhone:function(phone,pattern){
			pattern = typeof(pattern) == 'undefined' ? '^1((3)|(4)|(5)|(8)|(9))[0-9]{9}$' : pattern;
			pattern = new RegExp(pattern);
			if(this._necessarily==true){
				if(pattern.test(phone)==false){
					return false;
				}
			}
			else{
				if(phone!='' && phone!=null && pattern.test(phone)==false){
					return false;
				}
			}
			return true;
		},
		chkChinese:function(chinese){
			this._reg = /^([\u4E00-\uFA29]|[\uE7C7-\uE7F3]){2,10}$/;
			if(this._necessarily){
				if(this._reg.test(chinese)==false){
					return false;
				}
			}
			return true;
		},
		chkMail:function(mail){
			this._reg = /^\w+([-\.]\w+)*@\w+([\.-]\w+)*\.\w{2,4}$/;
			if(this._necessarily){
				if(this._reg.test(mail)==false){
					return false;
				}
			}
			return true;
		}
		
};
var popup = juxiangyou.component.popup;